import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'

export default defineConfig({
  plugins: [react()],
  css: {
    postcss: './postcss.config.js',
  },
  server: {
    port: 3000,
    open: true
  },
  resolve: {
    alias: {
      'cxl-react-components': path.resolve(__dirname, './dist/index.esm.js'),
      '../dist/index': path.resolve(__dirname, './dist/index.esm.js')
    }
  },
  build: {
    outDir: 'dist-example',
    rollupOptions: {
      external: ['react', 'react-dom'],
      output: {
        globals: {
          react: 'React',
          'react-dom': 'ReactDOM'
        }
      }
    }
  }
})
